package com.treasure.common.utils;

import lombok.experimental.UtilityClass;
import org.apache.commons.collections.CollectionUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author sunhongmin
 * @date 2023/8/25 19:47
 * @description
 */
@UtilityClass
public class EmbeddingConvert {

    public static final String DELIMITER = ",";

    public String toString(List<Double> embeddings) {
        if (CollectionUtils.isEmpty(embeddings)) {
            return "";
        }
        return embeddings.stream().map(String::valueOf).collect(Collectors.joining(DELIMITER));
    }

}
